﻿$(document).ready(function() {
    console.log($("#wrapper").offset().top);
    $("#container").scroll(function() {
        var thisY = $("#wrapper").offset().top;
        var isVisible = $("#header_wrapper").is(':visible');
        if (thisY < -25) {
            if (isVisible) {
                $("#header_wrapper, #header, #cssmenu").fadeOut(300, function() {
                    $("#header").css("height", "30px");
                    $("#header, #cssmenu").fadeIn(300);
                });
            }
        } else if (thisY > -25) {
            if (!isVisible) {
                $("#header, #cssmenu").fadeOut(300, function() {
                    $("#header").css("height", "90px");
                    $("#header_wrapper, #header, #cssmenu").fadeIn(300);
                });
            }
        }
    });
});

function showError() {
    alert('ERROR:' + "\n\n" +
        'There is a problem in processing the request.' + "\n" +
        'The server might be busy or temporary unavailable.' + "\n\n" +
        'Please try again or refresh your browser.' + "\n" +
        'If the problem persist, please contact your system administrator.');
}